package com.ccc.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * UserStorage entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "user_storage")
public class UserStorage implements java.io.Serializable {

	// Fields

	private Integer id;
	private Storage storage;
	private User user;
	private Integer currentTime;
	private Integer storageRentCount;
	private Integer storageBuyCount;

	// Constructors

	/** default constructor */
	public UserStorage() {
	}

	/** full constructor */
	public UserStorage(Storage storage, User user, Integer currentTime,
			Integer storageRentCount, Integer storageBuyCount) {
		this.storage = storage;
		this.user = user;
		this.currentTime = currentTime;
		this.storageRentCount = storageRentCount;
		this.storageBuyCount = storageBuyCount;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "storageId", nullable = false)
	public Storage getStorage() {
		return this.storage;
	}

	public void setStorage(Storage storage) {
		this.storage = storage;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "userId", nullable = false)
	public User getUser() {
		return this.user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	@Column(name = "currentTime", nullable = false)
	public Integer getCurrentTime() {
		return this.currentTime;
	}

	public void setCurrentTime(Integer currentTime) {
		this.currentTime = currentTime;
	}

	@Column(name = "storageRentCount", nullable = false)
	public Integer getStorageRentCount() {
		return this.storageRentCount;
	}

	public void setStorageRentCount(Integer storageRentCount) {
		this.storageRentCount = storageRentCount;
	}

	@Column(name = "storageBuyCount", nullable = false)
	public Integer getStorageBuyCount() {
		return this.storageBuyCount;
	}

	public void setStorageBuyCount(Integer storageBuyCount) {
		this.storageBuyCount = storageBuyCount;
	}

}